#ifndef SCREENSHOTOVERLAY_H
#define SCREENSHOTOVERLAY_H

#include <QWidget>
#include <QPixmap>
#include <QRect>

class QPaintEvent;
class QMouseEvent;
class QKeyEvent;

class ScreenshotOverlay : public QWidget
{
    Q_OBJECT
public:
    explicit ScreenshotOverlay(QWidget *parent = nullptr);

protected:
    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void keyPressEvent(QKeyEvent *event) override;

signals:
    void screenshotTaken(const QPixmap& image);

private:
    QPoint m_startPoint;            //起始点
    QPoint m_endPoint;              //终止点
    bool m_isSelecting;             //判断是否在截图
    QPixmap m_desktopImage;         //存储整个桌面的快照

};

#endif // SCREENSHOTOVERLAY_H
